#{extends 'main.html' /}
#{set title:'Admin categories' /}

#{if categories.empty}
    <div class="alert alert-info">
        No categories yet.
    </div>
#{/if}
#{else}
    <table class="table table-striped table-selectable">
        <caption>Categories</caption>
        <tbody>
            #{list items:categories, as:'category'}
                <tr>
                    <td><a href="@{AdminCategories.editForm(category.id)}" title="Edit category">${category.name}</a></td>
                    <td>#{categoryDescription category/}</td>
                    <td>
                        <a href="@{AdminCategories.editForm(category.id)}" class="btn btn-mini action" 
                           title="Edit category"><i class="icon-edit"></i> Edit</a>
                        <a href="@{AdminCategories.confirmDelete(category.id)}" class="btn btn-danger btn-mini action" 
                           title="Delete category"><i class="icon-trash icon-white"></i> Delete</a>
                    </td>
                </tr>
            #{/list}
        </tbody>
    </table>
#{/else}

<a class="btn btn-primary" href="@{AdminCategories.addForm()}"><i class="icon-plus icon-white"></i> New category</a>
